package com.nengchuan.kbms.dfs.constant;

import com.nengchuan.config.exception.NcException;
import lombok.Data;
import lombok.val;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 * 描述
 * </p>
 *
 * @auther luoping
 * @since 2020/3/19
 */
public interface BaseConstant {

    /** 成功 */
    String SUCCESS = "1";
    /** 失败 */
    String FAIL = "0";

    /** 设备 */
    String EQUIPMENT = "equipment";
    /** 供应商 */
    String FACTORY = "factory";

    class SplitLetter {
        public static final String COMMA = ",";
        public static final String SEMI = ";";
        public static final String Y_AXIS = "|";
    }

    class MessageType {
        /** 分享信息 */
        public static final String SHARE = "share";
        /** 系统信息 */
        public static final String SYS = "sys";
    }

    class Folder {

        /** 默认根节点id（文件夹树 & 用户文件夹树 */
        public static final Long ROOT_ID = 0L;

    }


    enum BizType {

        d("文件夹"), f("文件");

        private String value;

        BizType(String value) {
            this.value = value;
        }

        public static BizType verify(String value) {
            try {
                return BizType.valueOf(value);
            } catch (IllegalArgumentException e) {
                throw new NcException("错误的类型: " + value);
            }
        }

        public String getValue() {
            return value;
        }

    }

    /**
     * 类型编码
     */
    class TypeCode {

        /** 消息类型 */
        public static final String MESSAGE_TYPE = "message_type";

        /** 操作类型 */
        public static final String OPT_TYPE = "opt_type";

        /** 扩展名类型 */
        public static final String EXT_TYPE = "ext_type";

    }
}
